using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebControls;
using System.ComponentModel;
using System.Security.Permissions;
using System.IO;

namespace SharePointing.Features.MetaTags.Controls
{
    /// <summary>
    /// Appropriated from this blog post: http://www.mtelligent.com/journal/2008/1/11/using-the-delegate-control-to-add-meta-tags-to-sharepoint-pa.html
    /// 
    /// Install this as a delegate control using this type of feature:
    /// <?xml version="1.0" encoding="utf-8" ?>
    ///<Feature xmlns="http://schemas.microsoft.com/sharepoint/" 
    ///  Id="77612515-E4B5-438b-8684-F3415C2D722F"
    ///  Title="Meta Tagger"
    ///  Description="Injects Meta Tags into AdditionalPage Head Delegate Control"
    ///  Scope="Site"
    ///  Hidden="FALSE">
    ///
    ///  <ElementManifests>
    ///    <ElementManifest Location="MetaTaggerSettings.xml"/>
    ///  </ElementManifests>
    ///</Feature>
    ///
    /// And then the Element Manifest that defines the Delegate Control:
    /// 
    /// <?xml version="1.0" encoding="utf-8" ?>
    ///<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    ///  <Control Id="AdditionalPageHead" Sequence="50"
    ///    ControlClass="SharePointing.Features.MetaTags.MetaTagger"
    ///    ControlAssembly="SharePointing.Features.MetaTags, Version=1.0.0.0, Culture=neutral, 
    ///    PublicKeyToken=eaf5ef06195f8257" /> 
    ///</Elements> 
    /// 
    /// </summary>
    [ToolboxData("<{0}:MetaTagger runat=\"server\" name=\"\"> </{0}:MetaTagger>")]
    public class MetaTagger : WebControl
    {
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            // Write Out the tags (buried all of this into the 
            writer.Write(Common.Utilities.GetMetaTags());

        }
    }
}
